package com.wc.算法提高课.C第三章_图论.无向图的双连通分量.冗余路径;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/10/22 15:05
 * @description https://www.acwing.com/problem/content/397/
 */
public class Main {
    /**
     * 思路：无向图的双连通分量中的边连通分量<p>
     * 需要增加的边数是tarjan算法后, 缩点后度数为 1 的个数除以 2 上取整
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 5010, M = 200010;
    static int[] h = new int[N], e = new int[M], ne = new int[M];
    static int[] id = new int[N], stk = new int[N];
    static int[] dfn = new int[N], low = new int[N], d = new int[N];
    static boolean[] isBridge = new boolean[M];
    static int idx = 1, dcc_cnt = 0, top = 0, timestamp = 0;
    static int n, m;

    public static void main(String[] args) {
        n = sc.nextInt();
        m = sc.nextInt();
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt(), b = sc.nextInt();
            add(a, b);
            add(b, a);
        }
        tarjan(1, -1);
        for (int i = 1; i < idx; i++) {
            int j = e[i];
            if (isBridge[i]) d[id[j]]++;
        }
        int cnt = 0;
        for (int i = 1; i <= dcc_cnt; i++) {
            if (d[i] == 1) cnt++;
        }
        int res = (cnt + 1) / 2;
        out.println(res);
        out.flush();
    }

    static void add(int a, int b) {
        e[idx] = b;
        ne[idx] = h[a];
        h[a] = idx++;
    }

    static void tarjan(int u, int from) {
        dfn[u] = low[u] = ++timestamp;
        stk[++top] = u;
        for (int i = h[u]; i > 0; i = ne[i]) {
            int j = e[i];
            if (dfn[j] == 0) {
                tarjan(j, i);
                low[u] = Math.min(low[u], low[j]);
                if (dfn[u] < low[j]) {
                    isBridge[i] = isBridge[xor(i)] = true;
                }
            } else if (i != xor(from))
                low[u] = Math.min(low[u], dfn[j]);
        }

        if (dfn[u] == low[u]) {
            ++dcc_cnt;
            int y;
            do {
                y = stk[top--];
                id[y] = dcc_cnt;
            } while (y != u);
        }
    }

    static int xor(int x) {
        return x + ((x & 1) == 1 ? 1 : -1);
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
